package com.ranjiaqi.output;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @ClassName TestFileCopy
 * @Description TODO
 * @Author hp
 * @Date 2021/7/1 11:38
 * @Version 1.0
 **/
public class TestFileCopy {
    public static void main(String[] args) {
        copyFile_01();
    }

    public static void copyFile_01() {
        try (FileInputStream fis = new FileInputStream("F:/java/1.txt")
             ; FileOutputStream fos = new FileOutputStream("F:/java/2.txt")) {
            byte[] bytes = new byte[5];
            int x = 0;
            while ( (x = fis.read(bytes))!=-1){
                fos.write(bytes);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /*public static void copyFile_02(){
        try (){

        }
    }*/
}
